﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Mmht.BT;

public partial class player : BasePage
{
    GetMovie  gm = new GetMovie();
    public string movieUrl;
    public int id = 0;
    public DataRow movieDetail;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["type"] == null)
        {
            Response.Redirect("login.aspx");
            return;
        }
        if (!IsPostBack)
        {
            if (Request["id"] != null)
            {
                id = int.Parse(Request["id"]);
                this.getmovieDetail(id);
                ViewNumberBT vn = new ViewNumberBT();
                vn.addMovieViewNum(id);
            }
        }
        controlRepeater();
    }
    private void controlRepeater()
    {
        DataTable table1 = gm.Get_Recommended_Movie();
        DataTable table3 = gm.Get_CTRtop_Movie(9);

        this.Repeater1.DataSource = table3;
        this.Repeater1.DataBind();

        this.Repeater3.DataSource = table1;
        this.Repeater3.DataBind();
    }

    private void getmovieDetail(int id)
    {
        movieDetail = gm.GetmovieById(id);
        if (movieDetail == null)
        {
            movieUrl = string.Empty;
            return;
        }
        movieUrl = movieDetail["movie_url"].ToString();
    }


    public string getViewHostClass(Object number)
    {
        return ViewHotBT.getViewHostClass(number);
    }
}
